home *** CD-ROM | disk | FTP | other *** search
- -----------------------------------------------------------
- -- Global return value in loading/creation of new objects
- -----------------------------------------------------------
- Loading_RetVal = 0
-
- ------------------------------------------
- ---------- Init functions ----------------
- ---------- loading script ----------------
- ------------------------------------------
-
-
- -- creating one object from object's table
-
- function CreateObject (ObjectTable)
-
- -- create it trough ClassFarm
- local newobject = 0
- newobject = P_CreateInstance(ObjectTable.CLSID, ObjectTable.Name, ObjectTable.OptionalID, ObjectTable.IsDescription, ObjectTable.Description)
-
- if (newobject ~= nil) then
-
- -- start setting properties
-
- local prop = "prop_"
- local index = 1;
- local property = prop..index
-
- while (ObjectTable[property] ~= nil) do
- local property_name = ObjectTable[property][1]
- local property_clsid = ObjectTable[property][2]
- local property_val = ObjectTable[property][3]
-
- -- test for vector
- if type(property_val) == "table" then
- local tb = property_val
- local i=1;
- while (i~=0) do
- vecelem_name = tb[i];
- if (vecelem_name == nil) then do break end
- else
- P_InsertObject(newobject, property_name, property_clsid, vecelem_name)
- i = i+1;
- end;
- end;
- else
- -- set object's property
- P_SetProperty(newobject, property_name, property_clsid, property_val)
- end;
- index = index +1
- property = prop..index;
- end;
- end;
- --return newobject;
-
- -- set global return value
- Loading_RetVal = newobject;
-
- end;
-
- function ModifyObject (ObjectTable)
-
-
- end;
-
- function CreateGUI (ObjectName)
-
- -- create it trough ClassFarm
- local newobject = 0
- newobject = P_CreateInstance( 29, ObjectName, 0, 0)
-
- -- set global return value
- Loading_RetVal = newobject;
-
- SETACTIVEGUI(newobject);
-
- --return newobject;
- return newobject;
- end;
-